<script>
    /**
     * leetcode 1502
     * @param {number[]} arr
     * @return {boolean}
     */
    var canMakeArithmeticProgression = function (arr) {   
        arr.sort((a,b)=>b-a);
        console.log(arr);
        let diff = arr[0]-arr[1];
        for(let i=0;i<arr.length-1;i++){
            if(arr[i]-arr[i+1]!==diff){
                return false;
            }
        }
        return true;
    };
    const arr=[3,5,1];
    console.log(canMakeArithmeticProgression(arr));
</script>